<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户中心 - 登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/static/user/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/user/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/static/user/css/animate.css" rel="stylesheet">
    <link href="/static/user/css/style.css?v=4.1.0" rel="stylesheet">
	<link href="/static/user/css/login.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
</head>

<body class="signin">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">BY</h1>

            </div>
            <h3>欢迎使用 Boyou Network</h3>

            <form class="m-t" role="form" action="{:url('login')}">
                <div class="form-group">
                    <input type="text" name="account" class="form-control" placeholder="用户名（注册的手机号）" required>
                </div>
                <div class="form-group">
                    <input type="password" name="password" class="form-control" placeholder="登录密码" required>
                </div>
				
				<div class="form-group">
                    <div class="col-md-8" style="padding: 0;"><input type="text" name="code" class="form-control" placeholder="验证码" required></div>
					<div class="col-md-4" style="padding: 0;"><img class="verifyimg" alt="image" src="{:url('verifyImg')}" style=" width: 85%; height: 31px; float: right;"></div>
                </div>
                <button type="submit" class="btn btn-w-m btn-success block full-width m-b">登 录</button>

                <div class="check-tips" style="color:#ff0000;"></div>
                <p class="text-muted text-center">
                    <a href="register.html">注册一个新账号</a> |
                    <a href="forget.html"><small>忘记密码？</small></a>
                </p>
				<p>
				<a href="https://beian.miit.gov.cn/" target="_blank" style="color:#fff;">渝ICP备15004925号-16</a>
				</p>

            </form>
        </div>
    </div>

    <!-- 全局js -->
    <script src="/static/user/js/jquery.min.js?v=2.1.4"></script>
    <script src="/static/user/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/static/common/js/wenzi.js?v=3.3.6"></script>
    <script>
        //表单提交
        $(document)
            .ajaxStart(function(){
                $("button:submit").addClass("log-in").attr("disabled", true);
            })
            .ajaxStop(function(){
                $("button:submit").removeClass("log-in").attr("disabled", false);
            });

        $("form").submit(function(){
            var self = $(this);
            $.post(self.attr("action"), self.serialize(), success, "json");
            return false;

            function success(data){
                if(data.code){
                    window.location.href = data.url;
                } else {
                    self.find(".check-tips").text(data.msg);
                    //刷新验证码
                    $(".verifyimg").click();
                }
            }
        });

        $(function(){
            //初始化选中用户名输入框
            $("#itemBox").find("input[name=username]").focus();
            //刷新验证码
            var verifyimg = $(".verifyimg").attr("src");
            $(".verifyimg").click(function(){
                if( verifyimg.indexOf('?')>0){
                    $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
                }else{
                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
                }
            });

            //placeholder兼容性
            //如果支持
            function isPlaceholer(){
                var input = document.createElement('input');
                return "placeholder" in input;
            }
            //如果不支持
            if(!isPlaceholer()){
                $(".placeholder_copy").css({
                    display:'block'
                })
                $("#itemBox input").keydown(function(){
                    $(this).parents(".item").next(".placeholder_copy").css({
                        display:'none'
                    })
                })
                $("#itemBox input").blur(function(){
                    if($(this).val()==""){
                        $(this).parents(".item").next(".placeholder_copy").css({
                            display:'block'
                        })
                    }
                })
            }
        });
    </script>
    

</body>

</html>
